//
//  BAHomeModel.swift
//  BAweibo
//
//  Created by baggio on 2017/8/17.
//  Copyright © 2017年 baggio. All rights reserved.
//

import UIKit

//Model 一定要继承 NSObject 类
class BAHomeModel: NSObject {
    var created_at: Date? //创建时间 "Tue May 31 17:46:55 +0800 2011"，String 改成 Date
    var id: Int64 = 0 //微博id，Int 改成 Int64
    var text: String? //微博内容
    var source: String? //微博来源 "<a href="http://weibo.com" rel="nofollow">新浪微博</a>"
    
    var user: BAUserModel? //用户模型
    var retweeted_status: BAHomeModel? //转发微博
    var pic_urls: [BAPictureUrlModel]? //配图，是个 dict 数组，但是开发的时候需要用 model 数组
    /*
     ......
     "pic_urls" = (
        {
            "thumbnail_pic" = "http://wx2.sinaimg.cn/thumbnail/70e11e0fly1fipewv1bjwj20kv0fk4qp.jpg";
        },
        {
            "thumbnail_pic" = "http://wx3.sinaimg.cn/thumbnail/70e11e0fly1fipewvcouhj20kr0e61f9.jpg";
        },
        {
            "thumbnail_pic" = "http://wx4.sinaimg.cn/thumbnail/70e11e0fly1fipeyj0hgfj20br0cwtle.jpg";
        }
     );
     ......
     */
    
    /*
     YYModel 文档中：
     @property NSArray *shadows; //Array<Shadow>
     @implementation Attributes
     // 返回容器类中的所需要存放的数据类型 (以 Class 或 Class Name 的形式)。
     + (NSDictionary *)modelContainerPropertyGenericClass {
     return @{@"shadows" : [Shadow class],
     @"borders" : Border.class,
     @"attachments" : @"Attachment" };
     }
     @end
     */
    
    static func modelContainerPropertyGenericClass() -> [String: Any]{
        return ["pic_urls": BAPictureUrlModel.self]
    }
    
    //这个是 NSObject 类中的
    override var description: String {
        let keys = ["created_at","id","text","source","user","retweeted_status","pic_urls"]
        return dictionaryWithValues(forKeys: keys).description
    }

}
